library(tidyverse)
library(ggplot2)  
library(plotly)
levels_df <- read.csv("./levels-cleaned.csv")
drop <- c("X", "timestamp")
levels_df <- levels_df[,!(names(levels_df) %in% drop)]
levels_df
Sys.setenv("MAPBOX_TOKEN" = "pk.eyJ1IjoidGltb3RoeW5ndXllIiwiYSI6ImNrbW8wZmR0OTF6cnoycHQ0ZXFydTBwY3oifQ.LumCjldRn9X9jX70p1BA-w")

Let’s take a look at highest total compensation by entry level candidates

new_entry <- levels_df %>%
  filter(yearsofexperience <= 1.5)
new_entry_tc <- new_entry %>%
  group_by(city, state)
new_entry_tc
new_entry_tc <- aggregate(new_entry_tc$totalyearlycompensation, 
                          by=list(location=new_entry_tc$location,
                                  zip=new_entry_tc$zip, 
                                  lat=new_entry_tc$lat, 
                                  long=new_entry_tc$long,
                                  #year=new_entry_tc$year,
                                  state=new_entry_tc$state), 
                          FUN=mean, na.action = na.omit)
names(new_entry_tc)[names(new_entry_tc) == "x"] <- "tc"
new_entry_tc 
fig <- new_entry_tc
fig <- fig %>%
  plot_mapbox() %>%
  add_markers(x = ~long,
              y = ~lat,
              color = ~state,
              size = ~tc*100,
              text = ~paste0(location, "<br>",
                 "<b>Total Yearly Compensation:</b> $", tc)) %>%
  layout(
    mapbox = list(
      style = 'open-street-map',
      center = list(lon = -97, lat = 38),
      zoom = 2.5)) 

fig
`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.n too large, allowed maximum for palette Set2 is 8
Returning the palette you asked for with that many colors
n too large, allowed maximum for palette Set2 is 8
Returning the palette you asked for with that many colors
`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.`line.width` does not currently support multiple values.n too large, allowed maximum for palette Set2 is 8
Returning the palette you asked for with that many colors
n too large, allowed maximum for palette Set2 is 8
Returning the palette you asked for with that many colors
LS0tDQp0aXRsZTogIkxldmVscyBUQyBBbmFseXNpcyINCm91dHB1dDogaHRtbF9ub3RlYm9vaw0KLS0tDQoNCmBgYHtyfQ0KbGlicmFyeSh0aWR5dmVyc2UpDQpsaWJyYXJ5KGdncGxvdDIpICANCmxpYnJhcnkocGxvdGx5KQ0KYGBgDQoNCmBgYHtyfQ0KbGV2Z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sDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI3llYXI9bmV3X2VudHJ5X3RjJHllYXIsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGU9bmV3X2VudHJ5X3RjJHN0YXRlKSwgDQogICAgICAgICAgICAgICAgICAgICAgICAgIEZVTj1tZWFuLCBuYS5hY3Rpb24gPSBuYS5vbWl0KQ0KbmFtZXMobmV3X2VudHJ5X3RjKVtuYW1lcyhuZXdfZW50cnlfdGMpID09ICJ4Il0gPC0gInRjIg0KbmV3X2VudHJ5X3RjIA0KYGBgDQoNCmBgYHtyfQ0KZmlnIDwtIG5ld19lbnRyeV90Yw0KZmlnIDwtIGZpZyAlPiUNCiAgcGxvdF9tYXBib3goKSAlPiUNCiAgYWRkX21hcmtlcnMoeCA9IH5sb25nLA0KICAgICAgICAgICAgICB5ID0gfmxhdCwNCiAgICAgICAgICAgICAgY29sb3IgPSB+c3RhdGUsDQogICAgICAgICAgICAgIHNpemUgPSB+dGMqMTAwLA0KICAgICAgICAgICAgICB0ZXh0ID0gfnBhc3RlMChsb2NhdGlvbiwgIjxicj4iLA0KICAgICAgICAgICAgICAgICAiPGI+VG90YWwgWWVhcmx5IENvbXBlbnNhdGlvbjo8L2I+ICQiLCB0YykpICU+JQ0KICBsYXlvdXQoDQogICAgbWFwYm94ID0gbGlzdCgNCiAgICAgIHN0eWxlID0gJ29wZW4tc3RyZWV0LW1hcCcsDQogICAgICBjZW50ZXIgPSBsaXN0KGxvbiA9IC05NywgbGF0ID0gMzgpLA0KICAgICAgem9vbSA9IDIuNSkpIA0KDQpmaWcNCmBgYA0KDQpgYGB7cn0NCg0KYGBgDQo=